import 'package:flutter/material.dart';
import 'package:flutter_architecture/src/features/authentication/data/fake_auth_repository.dart';
import 'package:flutter_architecture/src/features/authentication/presentation/sign_in_screen.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'account_screen.dart';

///@Description     xxxx
///@author          Wonderful
///@create          2024-09-14 10:41
class AuthScreen extends ConsumerWidget {
  const AuthScreen({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final authState = ref.watch(authStateChangesProvider);
    return authState.maybeWhen(
        data: (user) =>
            user != null ? const AccountScreen() : const SignInScreen(),
        orElse: () => Scaffold(
            appBar: AppBar(),
            body: const Center(child: CircularProgressIndicator())));
  }
}
